import java.util.ArrayList;
import java.util.List;

/**
 * Represents a class in the abstract syntax
 * Contains a list of methods and non methods
 */
public class AbstractAndroidClass {

	private String name;
	private List <AbstractNonMethod> nonMethodList;
	private List <AbstractAndroidMethod> methodList;
	
	public AbstractAndroidClass (String name) {
		
		methodList = new ArrayList <AbstractAndroidMethod> ();
		nonMethodList = new ArrayList <AbstractNonMethod> ();
		this.name = name;
	}
	
	public void addAbstractAndroidMethod (AbstractAndroidMethod method) {
		if(!methodList.contains(method)){
			methodList.add(method);
			method.setAndroidClass(this);
		}
	}
	
	public void addAbstractNonMethod (AbstractNonMethod nonMethod) {
		if(!nonMethodList.contains(nonMethod)){
			nonMethodList.add(nonMethod);
			nonMethod.setAndroidClass(this);
		}
	}
	
	
	public void addnonMethod (AbstractAndroidMethod method) {
		if(!methodList.contains(method)){
			methodList.add(method);
			method.setAndroidClass(this);
		}
	}
	
	public void setName (String name) {
		this.name = name;
	}
	
	public List<AbstractAndroidMethod> getAbstractAndroidMethods () {
		return methodList;
	}
	
	public List<AbstractNonMethod> getNonMethods () {
		return nonMethodList;
	}
	
	public String getName() {
		return name;
	}
	
	public boolean equals(Object obj) {
		if (!(obj instanceof AbstractAndroidClass)) {
			return false;
		}
		AbstractAndroidClass classObj = (AbstractAndroidClass) obj;
		return classObj.getName().equals(name); 
	}
}
